package com.atguigu.tingshu.album.mapper;

import com.atguigu.tingshu.model.album.TrackInfo;
import com.atguigu.tingshu.query.album.TrackInfoQuery;
import com.atguigu.tingshu.vo.album.TrackListVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface TrackInfoMapper extends BaseMapper<TrackInfo> {


    /**
     * 获取当前用户声音分页列表
     * @param pageInfo MP分页对象
     * @param trackInfoQuery 模糊查询属性
     * @return
     */
    Page<TrackListVo> findUserTrackPage(Page<TrackListVo> pageInfo, @Param("vo") TrackInfoQuery trackInfoQuery);

    @Update("update track_info set order_num = order_num - 1 where album_id = #{albumId} and order_num > #{orderNum}")
    void updateOrderNum(@Param("albumId") Long albumId, @Param("orderNum") Integer orderNum);
}
